﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;

namespace Managistics.Model.Mappings
{
    public class InputSheetMap : ClassMap<InputSheet>
    {

        public InputSheetMap()
        {
            Schema(Constants._tblSchema);
            Table(Constants._tblInputSupplierDomestic);
            LazyLoad();

            Id(x => x.InputSheetId).GeneratedBy.Assigned().Column("INPUT_SHEET_D_ID");
            References(x => x.PurchaseOrder).Column("ORDERID_NN");
            
            Map(x => x.InventoryNameTD).Column("INVENTORY_NAME_TD").Not.Nullable().Length(50);
            Map(x => x.InputSheetDate).Column("INPUT_SHEET_D_DATE").Not.Nullable();
            Map(x => x.DelivererName).Column("DELIVERER_NAME_SD").Not.Nullable().Length(50);
            Map(x => x.ReceiverName).Column("RECEIVER_D_NAME").Not.Nullable().Length(50);
            Map(x => x.Note).Column("NOTE_INPUT_SHEET_D").Length(200);

            HasMany(x => x.InputSheetDetail).KeyColumn("INPUT_SHEET_D_ID").Inverse().Not.LazyLoad();
        }
    }
}
